package com.hnhcyy.goods.properties;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;

@Component
@RefreshScope // 刷新配置文件
public class ImageConfig {
	
	//静态属性不能读取配置文件
	
	/**
	 * 图片公共前缀 oss.hnhcyy.cn
	 */
	public static String imgUrlPrefix;
	
	/**
	 * 商品图url前缀
	 */
	public static String goodsPicturePrefix;
	
	/**
	 * 轮播图url前缀
	 */
	public static String bannerPicturePrefix;

	@Value("${img.url.prefix}")
	public void setImgUrlPrefix(String imgUrlPrefix) {
		ImageConfig.imgUrlPrefix = imgUrlPrefix;
	}

	@Value("${goods.picture.prefix}")
	public void setGoodsPicturePrefix(String goodsPicturePrefix) {
		ImageConfig.goodsPicturePrefix = goodsPicturePrefix;
	}

	@Value("${banner.picture.prefix}")
	public void setBannerPicturePrefix(String bannerPicturePrefix) {
		ImageConfig.bannerPicturePrefix = bannerPicturePrefix;
	}
	
	
	
}
